package com.toe.commodity.webapi.controller;

import com.toe.commodity.service.CommodityGoodsSpecificationsService;
import com.toe.common.restful.JsonResult;
import com.toe.pojo.vo.commodity.CommodityGoodsSpecificationsVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 陶涛
 * @since 2022-07-19
 */
@RestController
@RequestMapping("/commodity-goods-specifications")
@Api(tags = "商品规格模块")
public class CommodityGoodsSpecificationsController {
    @Autowired
    CommodityGoodsSpecificationsService commodityGoodsSpecificationsService;

    @GetMapping("/{id}")
    @ApiOperation("通过规格id获取规格价格")
    @ApiImplicitParam(value = "规格id", name = "id", required = true,
            dataType = "long", example = "1")
    public JsonResult<CommodityGoodsSpecificationsVO> getPriceById(@PathVariable Long id) {
        return JsonResult.ok(
                commodityGoodsSpecificationsService.getSpecificationsById(id));
    }

}

